package com.mpaster.controller;

import com.mpaster.entity.User;
import com.mpaster.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {

    @Autowired
    private UserService userService;

    @RequestMapping("/hello")
    public String hello() {
        User user = userService.getUser(1);
        String username = "Docker";
        if (user != null) {
            username = user.getUsername();
        }
        return String.format("Hello %s !", username);
    }
}
